Skip to content

Closes #490 fix_replace_symbol_in_expr: handle NAs and recursions#491

Merged
bms63 merged 1 commit intomainfrom
490_fix_replace_symbol_in_expr
May 7, 2025
Merged

Closes #490 fix_replace_symbol_in_expr: handle NAs and recursions#491
bms63 merged 1 commit intomainfrom
490_fix_replace_symbol_in_expr

Conversation

@bundfussr
Copy link
Copy Markdown
Collaborator

@bundfussr bundfussr commented May 7, 2025

Thank you for your Pull Request! We have developed this task checklist from the Development Process Guide to help with the final steps of the process. Completing the below tasks helps to ensure our reviewers can maximize their time on your code as well as making sure the admiral codebase remains robust and consistent.

Please check off each taskbox as an acknowledgment that you completed the task or check off that it is not relevant to your Pull Request. This checklist is part of the Github Action workflows and the Pull Request will not be merged into the main branch until you have checked off each task.

  • Place Closes #<insert_issue_number> into the beginning of your Pull Request Title (Use Edit button in top-right if you need to update)
  • Code is formatted according to the tidyverse style guide. Run styler::style_file() to style R and Rmd files
  • Updated relevant unit tests or have written new unit tests, which should consider realistic data scenarios and edge cases, e.g. empty datasets, errors, boundary cases etc. - See Unit Test Guide
  • If you removed/replaced any function and/or function parameters, did you fully follow the deprecation guidance?
  • Update to all relevant roxygen headers and examples, including keywords and families. Refer to the categorization of functions to tag appropriate keyword/family.
  • Run devtools::document() so all .Rd files in the man folder and the NAMESPACE file in the project root are updated appropriately
  • Address any updates needed for vignettes and/or templates
  • Update NEWS.md under the header # admiral (development version) if the changes pertain to a user-facing function (i.e. it has an @export tag) or documentation aimed at users (rather than developers)
  • Build admiral site pkgdown::build_site() and check that all affected examples are displayed correctly and that all new functions occur on the "Reference" page.
  • Address or fix all lintr warnings and errors - lintr::lint_package()
  • Run R CMD check locally and address all errors and warnings - devtools::check()
  • Link the issue in the Development Section on the right hand side.
  • Address all merge conflicts and resolve appropriately
  • Pat yourself on the back for a job well done! Much love to your accomplishment!

@bundfussr bundfussr linked an issue May 7, 2025 that may be closed by this pull request
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 7, 2025

Code Coverage

Package Line Rate Health
admiraldev 96%
Summary 96% (1354 / 1412)

Copy link
Copy Markdown
Collaborator

@bms63 bms63 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you help me understand what we mean by recursion in this context?

@bundfussr
Copy link
Copy Markdown
Collaborator Author

Could you help me understand what we mean by recursion in this context?

When I fixed the issue with the NAs, I noticed that only the first level of the syntax tree is considered. I.e., replace_symbol_in_expr(expr(if_else(AVAL > 0, AVAL, NA)), AVAL, AVAL.join) produced if_else(AVAL > 0, AVAL.join, NA) instead of if_else(AVAL.join > 0, AVAL.join, NA). I.e., if an argument of if_else() was just the symbol AVAL, it was replaced but when it was an expression like AVAL > 0, it wasn't replaced. This is fixed now.

@bms63
Copy link
Copy Markdown
Collaborator

bms63 commented May 7, 2025

we can fix the links another time

@bms63 bms63 merged commit 8724d99 into main May 7, 2025
106 of 114 checks passed
@bms63 bms63 deleted the 490_fix_replace_symbol_in_expr branch May 7, 2025 20:28
@bundfussr
Copy link
Copy Markdown
Collaborator Author

we can fix the links another time

I don't think that any of the links are broken. I've have re-run it several times and the link where it fails differs. Either there was much traffic on github.com yesterday or our workflow sent request so quickly that the server could not handle them.

Let's see if it happens again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: replace_symbol_in_expr() fails if the expression contains NA

2 participants